<?php
	header("Content-Type: text/html;charset=utf-8");
	include("function/_nosql.php"); //
	include("function/function.php");
	include("_include.user.judge.php");
	$action = chkstr(trim($_REQUEST['action']));
	$kboy_userid = $_SESSION['kboy_userid'];
	$orderid = chkstr(trim($_REQUEST['orderid']));//订单编号
	$order_tui_content = chkstr(trim($_REQUEST['order_tui_content']));//退款原因
	
	if(!is_numeric($orderid)){
	  echo erro("参数错误！");
	}
	if(getNewsNums("kboy_order","uid=".$_SESSION['kboy_userid']." and id=$orderid") <1){
	  echo erro("参数错误");
	}
	if($action == "tuimoney"){//保存订单信息
		
	    $order_states = 1;
		$mysql = new sqlstr("kboy_order"); 
		$mysql -> set("order_tui_content",$order_tui_content);
		$mysql -> set("order_states",$order_states);
		
		$news_sql = $mysql -> updateSql("uid=".$_SESSION['kboy_userid']." and id=$orderid");
		$news_res = mysql_query($news_sql);
		if($news_res){
			echo ok("操作成功","user_order.php");
		}else{
			echo erro("服务器内部错误");
		}
		
	}
	else if( $action == "tuiactive" ){
		
	 $order_states = 4;
		$mysql = new sqlstr("kboy_order"); 
		$mysql -> set("order_tuiactive_content",$order_tui_content);
		$mysql -> set("order_states",$order_states);
		
		$news_sql = $mysql -> updateSql("uid=".$_SESSION['kboy_userid']." and id=$orderid");
		$news_res = mysql_query($news_sql);
		if($news_res){
			echo ok("操作成功","user_order.php");
		}else{
			echo erro("服务器内部错误");
		}
	}
	else{
		echo erro("参数错误");
	}
	
?>